import React from 'react'
//App 父组件   Son子组件


function SonF(props) {
    const geta = props.geta
    const a = 'SonF的值'
  return (
    <>
      <div onClick={()=>geta(a)}>我子组件1</div>
    </>
  )
}
function SonC(props) {
    return (
      <>
        <div>我子组件2,{props.b}</div>
      </>
    )
  }
class App extends React.Component {
    geta=(a)=>{
      this.setState({
          b: a
      })
    }
    state = {
       b: 'xixi'
    }
  render() {
    return (
      <div>
        <SonF geta={this.geta}></SonF>
        <SonC b={this.state.b}></SonC>
      </div>
    )
  }
}

export default App
